﻿using System.Threading.Tasks;

namespace Sidvall.LogManager.Data.Entity.Model
{
    public sealed partial class StorageManager : global::Sidvall.Data.Entity.StorageManagerDbContextBase<StorageManager, global::Sidvall.LogManager.Data.Entity.Model.LogManagerEntities>, global::Sidvall.Data.IStorageManager
    {
        #region DeleteItemsAsync

        public async Task DeleteItemsAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.DeleteItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, global::Sidvall.Data.DeleteCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.DeleteItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, global::Sidvall.Data.DeleteCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.DeleteItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, global::Sidvall.Data.DeleteCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region ExecuteAsync

        public async Task ExecuteAsync(global::Sidvall.Business.DataPortalContext<global::Sidvall.Data.CommandCriteria, global::Sidvall.Data.CommandCriteria> dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.ExecuteAsync(this, dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.ExecuteAsync(this, dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.ExecuteAsync(this, dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region GetItemAsync

        public async Task GetItemAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.GetItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, global::Sidvall.Data.FetchCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeField, global::Sidvall.LogManager.Data.Relations.LogScopeRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.GetItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, global::Sidvall.Data.FetchCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemField, global::Sidvall.LogManager.Data.Relations.LogScopeItemRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.GetItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, global::Sidvall.Data.FetchCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField, global::Sidvall.LogManager.Data.Relations.LogScopeItemCategoryRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region GetItemCountAsync

        public async Task GetItemCountAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.GetItemCountAsync(this, (global::Sidvall.Business.DataPortalContext<long, global::Sidvall.Data.FetchCountCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.GetItemCountAsync(this, (global::Sidvall.Business.DataPortalContext<long, global::Sidvall.Data.FetchCountCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.GetItemCountAsync(this, (global::Sidvall.Business.DataPortalContext<long, global::Sidvall.Data.FetchCountCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region GetItemsAsync

        public async Task GetItemsAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.GetItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, global::Sidvall.Data.FetchListCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeField, global::Sidvall.LogManager.Data.Relations.LogScopeRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.GetItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, global::Sidvall.Data.FetchListCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemField, global::Sidvall.LogManager.Data.Relations.LogScopeItemRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.GetItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, global::Sidvall.Data.FetchListCriteria<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField, global::Sidvall.LogManager.Data.Relations.LogScopeItemCategoryRelation>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region NewItemAsync

        public async Task NewItemAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.NewItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.NewItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.NewItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region NewItemsAsync

        public async Task NewItemsAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.NewItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.NewItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.NewItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, global::Sidvall.Data.CreateCriteria>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region SaveItemAsync

        public async Task SaveItemAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.SaveItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, Sidvall.Data.SaveContext<global::Sidvall.LogManager.Data.ILogScope>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.SaveItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, Sidvall.Data.SaveContext<global::Sidvall.LogManager.Data.ILogScopeItem>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.SaveItemAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, Sidvall.Data.SaveContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region SaveItemsAsync

        public async Task SaveItemsAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.SaveItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScope, Sidvall.Data.SaveContext<Sidvall.Data.IDataRowProvider<global::Sidvall.LogManager.Data.ILogScope>>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.SaveItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItem, Sidvall.Data.SaveContext<Sidvall.Data.IDataRowProvider<global::Sidvall.LogManager.Data.ILogScopeItem>>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.SaveItemsAsync(this, (global::Sidvall.Business.DataPortalContext<global::Sidvall.LogManager.Data.ILogScopeItemCategory, Sidvall.Data.SaveContext<Sidvall.Data.IDataRowProvider<global::Sidvall.LogManager.Data.ILogScopeItemCategory>>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region UpdateItemAsync

        public async Task UpdateItemAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.UpdateItemAsync(this, (global::Sidvall.Business.DataPortalContext<bool, Sidvall.Data.UpdateItemContext<global::Sidvall.LogManager.Data.Fields.LogScopeField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.UpdateItemAsync(this, (global::Sidvall.Business.DataPortalContext<bool, Sidvall.Data.UpdateItemContext<global::Sidvall.LogManager.Data.Fields.LogScopeItemField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.UpdateItemAsync(this, (global::Sidvall.Business.DataPortalContext<bool, Sidvall.Data.UpdateItemContext<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        #region UpdateItemsAsync

        public async Task UpdateItemsAsync(global::Sidvall.Business.IDataPortalContext dataPortalContext)
        {
            switch (dataPortalContext.Resource)
            {
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScope:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeManager.UpdateItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, Sidvall.Data.UpdateItemsContext<global::Sidvall.LogManager.Data.Fields.LogScopeField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItem:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemManager.UpdateItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, Sidvall.Data.UpdateItemsContext<global::Sidvall.LogManager.Data.Fields.LogScopeItemField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                case global::Sidvall.LogManager.Data.Model.DomainObjects.LogScopeItemCategory:
                    await Sidvall.LogManager.Data.Entity.Model.StorageManagers.LogScopeItemCategoryManager.UpdateItemsAsync(this, (global::Sidvall.Business.DataPortalContext<int, Sidvall.Data.UpdateItemsContext<global::Sidvall.LogManager.Data.Fields.LogScopeItemCategoryField>>)dataPortalContext).ConfigureAwait(false);
                    break;
                default:
                    break;
            }
        }

        #endregion
        public static global::Sidvall.LogManager.Data.Entity.Model.StorageManager GetStorageManager()
        {
            return Sidvall.Data.Entity.StorageManagerDbContextBase<StorageManager, global::Sidvall.LogManager.Data.Entity.Model.LogManagerEntities>.GetManager();
        }
        public static global::Sidvall.LogManager.Data.Entity.Model.StorageManager GetStorageManager(string nameOrConnectionString)
        {
            return Sidvall.Data.Entity.StorageManagerDbContextBase<StorageManager, global::Sidvall.LogManager.Data.Entity.Model.LogManagerEntities>.GetManager(nameOrConnectionString);
        }
        private StorageManager()
        {
        }
    }
}